<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Gets the value associated with a key</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="chdb.construct.html">chdb::__construct</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="ref.chdb.html">chdb 函数</a></div>
 <div class="up"><a href="class.chdb.html">chdb</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="chdb.get" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">chdb::get</h1>
  <p class="verinfo">(PECL chdb &gt;= 0.1.0)</p><p class="refpurpose"><span class="refname">chdb::get</span> &mdash; <span class="dc-title">Gets the value associated with a key</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-chdb.get-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">string</span> <span class="methodname"><strong>chdb::get</strong></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$key</code></span>
   )</div>

  <p class="para rdfs-comment">
   Gets the value associated with a key from a chdb database.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-chdb.get-parameters">
  <h3 class="title">参数</h3>
  <dl>

   
    <dt>
<em><code class="parameter">key</code></em></dt>

    <dd>

     <p class="para">
      The key for which to get the value.
     </p>
    </dd>

   
  </dl>

 </div>


 <div class="refsect1 returnvalues" id="refsect1-chdb.get-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   Returns a string containing the value associated with the given
   <em><code class="parameter">key</code></em>, or <strong><code>NULL</code></strong> if not found.
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-chdb.get-examples">
  <h3 class="title">范例</h3>
  <div class="example" id="example-4115">
   <p><strong>Example #1 <span class="function"><strong>chdb::get()</strong></span> example</strong></p>
   <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /><br />$data&nbsp;</span><span style="color: #007700">=&nbsp;array(<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">'key1'&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #DD0000">'value1'</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">'key2'&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #DD0000">'value2'</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #FF8000">//&nbsp;...<br /></span><span style="color: #007700">);<br /></span><span style="color: #0000BB">chdb_create</span><span style="color: #007700">(</span><span style="color: #DD0000">'data.chdb'</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$data</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">$chdb&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">chdb</span><span style="color: #007700">(</span><span style="color: #DD0000">'data.chdb'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$value1&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$chdb</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">get</span><span style="color: #007700">(</span><span style="color: #DD0000">'key1'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$value2&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$chdb</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">get</span><span style="color: #007700">(</span><span style="color: #DD0000">'key2'</span><span style="color: #007700">);<br /><br />echo&nbsp;</span><span style="color: #0000BB">$value1</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">PHP_EOL</span><span style="color: #007700">;<br />echo&nbsp;</span><span style="color: #0000BB">$value2</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">PHP_EOL</span><span style="color: #007700">;<br /><br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
   </div>

   <div class="example-contents"><p>以上例程的输出类似于：</p></div>
   <div class="example-contents screen">
<div class="cdata"><pre>
value1
value2
</pre></div>
   </div>
  </div>
 </div>



</div><hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="chdb.construct.html">chdb::__construct</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="ref.chdb.html">chdb 函数</a></div>
 <div class="up"><a href="class.chdb.html">chdb</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>
